<template>
  <div class="_staffPage" style="padding-bottom:50px">
    <div class="opeCon">
      <van-cell title="数据统计" is-link @click="cellClick(1)"></van-cell>
      <van-cell title="生成海报" is-link @click="cellClick(2)"></van-cell>
      <van-cell title="视频列表" is-link @click="cellClick(3)"></van-cell>
      <van-cell v-if="canExport" title="导出数据" is-link @click="cellClick(4)"></van-cell>
    </div>
  </div>
</template>

<script>
import { Cell } from "vant";
import { mapActions } from "vuex";
import { downloadByUrl } from "@/js/utils";
export default {
  components: {
    [Cell.name]: Cell
  },
  data() {
    return {
      canExport: false
    };
  },
  computed: {
    userId() {
      return this.$store.state.userId;
    }
  },
  watch: {
    userId: {
      immediate: true,
      handler(val) {
        if (
          val &&
          [
            "oJOuUjoth7sO3ybUpUiPsEHYtkcs",
            "oJOuUjvrEpFgQbwCO98w0GpIn_Pg",
            "oJOuUjsGIWBpCjImWgcbgTdRWZAA",
            "oJOuUjt_cw2j7sRNQYOfU_7RCOVM",
            "oJOuUjqF2aSTPfJU6YP3q4x3SGHs"
          ].includes(val)
        ) {
          this.canExport = true;
        }
      }
    }
  },
  mounted() {},
  methods: {
    ...mapActions({ exportData: "exportData" }),
    cellClick(item) {
      switch (item) {
        case 1: {
          this.$router.push({
            name: "staffDataCount"
          });
          break;
        }
        case 2: {
          this.$router.push({
            name: "staffPostPage"
          });
          break;
        }
        case 3: {
          this.$router.push({
            name: "videoList"
          });
          break;
        }
        case 4: {
          location.href = `${process.env.VUE_APP_BASE_API}/port/activity/getExcel`;
          break;
        }
      }
    }
  }
};
</script>

<style lang="scss">
._staffPage {
  height: 100vh;
  background-color: #eee;
  box-sizing: border-box;
}
</style>